package Lamport;

public class Hostname {
	
	public String name;
	
	public int control;
	
	/**
	 * Creates a new Hostname object
	 * @param name (String) - The name of the host
	 * @param control (int) - 0 = This host controls the resource, 1 = This host doesnt not control the resource
	 */
	public Hostname (String name, int control) {
		this.name = name;
		this.control = control;
	}
	
	/**
	 * Function getName - Returns the name of the Hostname
	 * @return (String) Name to be returned
	 */
	public String getName() {
		return this.name;
	}
	
	/**
	 * Function getControl - Returns the the control number of the Hostname
	 * @return (int) The int representing the control of the resource. 0 = controlling, 1 = not controlling
	 */
	public int getControl() {
		return this.control;
	}
	
	/**
	 * Function changeControl - Changes the control of the resource for this Hostname
	 */
	public void changeControl() {
		if(control == 0)
			control = 1;
		else if (control == 1)
			control = 0;
		else
			System.out.println("Error - Control number out of bounds");
	}

}
